/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : val(x), next(NULL) {}
 * };
 */
class Solution {
public:
    ListNode *deleteDuplicates(ListNode *head) {
        ListNode *ret=head;
        while (head!=NULL)
            if (head->next!=NULL && head->val==head->next->val)
                head->next=head->next->next;
            else
                head=head->next;
        return ret;
    }
};
